{% extends "bootstrap/base.html" %}
{% import "bootstrap/wtf.html" as wtf %}

{% block head %}
{{ super() }}
<link rel="shortcut icon" href="{{ url_for('static', filename = 'favicon.ico') }}"
type="image/x-icon">
<link rel="icon" href="{{ url_for('static', filename = 'favicon.ico') }}"
type="image/x-icon">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css')}}">
{% endblock %}

{% block title %}BBS{% endblock %}

{% block navbar %}
<div class="navbar navbar-inverse" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle"
            data-toggle="collapse" data-target="navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">BBS</a>
        </div>
        <div class="navbar-collapse">
            <ul class="nav navbar-nav">
                <li><a href="{{ url_for('main.index') }}">首页</a></li>
                <li><a href="{{ url_for('main.boards') }}">版块</a></li>
                <li><a href="{{ url_for('main.compare') }}">比较</a></li>
                <li><a href="{{ url_for('main.search_user') }}">搜索用户</a></li>
                {% if current_user.is_authenticated %}}
                    <li><a href="{{ url_for('main.user', username=current_user.username)}}">个人</a> </li>
                {% endif %}
                {% if current_user.is_administrator()%}
                    <li><a href="{{ url_for('main.all_users')}}">管理用户</a> </li>
                {% endif %}
            </ul>
            <ul class="nav navbar navbar-right">
                {% if current_user.is_authenticated %}
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="{{ current_user.gravatar(size=18) }}">
                            {{current_user.username}} <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="{{ url_for('auth.change_password')}}">修改密码</a> </li>
                             <li><a href="{{ url_for('auth.change_email_request') }}">修改邮箱</a></li>
                            <li><a href="{{ url_for('auth.logout')}}">退出</a> </li>
                        </ul>
                    </li>
                {% else %}
                    <li><a href="{{ url_for('auth.login') }}">登录</a> </li>
                {% endif %}
            </ul>
        </div>
    </div>
</div>
{% endblock %}

<!-- 用于弹出用flash构造的信息 -->
{% block content %}
<div class="container">
    {% for message in get_flashed_messages() %}
    <div class="alert alert-warning">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        {{ message }}
    </div>
    {% endfor %}
   {% block page_content %}{% endblock %}
</div>

{% endblock %}

{% block scripts %}
{{ super() }}
{{ moment.include_moment() }}
{% endblock %}